{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello widerface\n",
      "('datas number is: ', 185184)\n",
      "fileCount:12880,boxCount:159424\n",
      "(1, ':processed--->', '0--Parade/0_Parade_marchingband_1_849.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_849.jpg\n",
      "\n",
      "(2, ':processed--->', '0--Parade/0_Parade_Parade_0_904.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_904.jpg\n",
      "\n",
      "(3, ':processed--->', '0--Parade/0_Parade_marchingband_1_799.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_799.jpg\n",
      "\n",
      "(4, ':processed--->', '0--Parade/0_Parade_marchingband_1_117.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_117.jpg\n",
      "\n",
      "(5, ':processed--->', '0--Parade/0_Parade_marchingband_1_778.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_778.jpg\n",
      "\n",
      "(6, ':processed--->', '0--Parade/0_Parade_Parade_0_343.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_343.jpg\n",
      "\n",
      "(7, ':processed--->', '0--Parade/0_Parade_marchingband_1_205.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_205.jpg\n",
      "\n",
      "(8, ':processed--->', '0--Parade/0_Parade_Parade_0_106.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_106.jpg\n",
      "\n",
      "(9, ':processed--->', '0--Parade/0_Parade_Parade_0_476.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_476.jpg\n",
      "\n",
      "(10, ':processed--->', '0--Parade/0_Parade_marchingband_1_12.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_12.jpg\n",
      "\n",
      "(11, ':processed--->', '0--Parade/0_Parade_marchingband_1_273.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_273.jpg\n",
      "\n",
      "(12, ':processed--->', '0--Parade/0_Parade_marchingband_1_928.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_928.jpg\n",
      "\n",
      "(13, ':processed--->', '0--Parade/0_Parade_Parade_0_337.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_337.jpg\n",
      "\n",
      "(14, ':processed--->', '0--Parade/0_Parade_marchingband_1_579.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_579.jpg\n",
      "\n",
      "(15, ':processed--->', '0--Parade/0_Parade_Parade_0_90.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_90.jpg\n",
      "\n",
      "(16, ':processed--->', '0--Parade/0_Parade_marchingband_1_300.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_300.jpg\n",
      "\n",
      "(17, ':processed--->', '0--Parade/0_Parade_Parade_0_782.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_782.jpg\n",
      "\n",
      "(18, ':processed--->', '0--Parade/0_Parade_Parade_0_449.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_449.jpg\n",
      "\n",
      "(19, ':processed--->', '0--Parade/0_Parade_Parade_0_325.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_325.jpg\n",
      "\n",
      "(20, ':processed--->', '0--Parade/0_Parade_Parade_0_136.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_136.jpg\n",
      "\n",
      "(21, ':processed--->', '0--Parade/0_Parade_Parade_0_1014.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_1014.jpg\n",
      "\n",
      "(22, ':processed--->', '0--Parade/0_Parade_marchingband_1_454.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_454.jpg\n",
      "\n",
      "(23, ':processed--->', '0--Parade/0_Parade_marchingband_1_483.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_483.jpg\n",
      "\n",
      "(24, ':processed--->', '0--Parade/0_Parade_Parade_0_87.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_87.jpg\n",
      "\n",
      "(25, ':processed--->', '0--Parade/0_Parade_marchingband_1_193.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_193.jpg\n",
      "\n",
      "(26, ':processed--->', '0--Parade/0_Parade_Parade_0_156.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_156.jpg\n",
      "\n",
      "(27, ':processed--->', '0--Parade/0_Parade_marchingband_1_631.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_631.jpg\n",
      "\n",
      "(28, ':processed--->', '0--Parade/0_Parade_Parade_0_469.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_469.jpg\n",
      "\n",
      "(29, ':processed--->', '0--Parade/0_Parade_Parade_0_438.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_438.jpg\n",
      "\n",
      "(30, ':processed--->', '0--Parade/0_Parade_marchingband_1_462.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_462.jpg\n",
      "\n",
      "(31, ':processed--->', '0--Parade/0_Parade_marchingband_1_624.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_624.jpg\n",
      "\n",
      "(32, ':processed--->', '0--Parade/0_Parade_Parade_0_138.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_138.jpg\n",
      "\n",
      "(33, ':processed--->', '0--Parade/0_Parade_Parade_0_570.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_570.jpg\n",
      "\n",
      "(34, ':processed--->', '0--Parade/0_Parade_Parade_0_148.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_148.jpg\n",
      "\n",
      "(35, ':processed--->', '0--Parade/0_Parade_Parade_0_577.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_577.jpg\n",
      "\n",
      "(36, ':processed--->', '0--Parade/0_Parade_Parade_0_652.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_652.jpg\n",
      "\n",
      "(37, ':processed--->', '0--Parade/0_Parade_Parade_0_687.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_687.jpg\n",
      "\n",
      "(38, ':processed--->', '0--Parade/0_Parade_marchingband_1_905.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_905.jpg\n",
      "\n",
      "(39, ':processed--->', '0--Parade/0_Parade_marchingband_1_82.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_82.jpg\n",
      "\n",
      "(40, ':processed--->', '0--Parade/0_Parade_marchingband_1_385.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_385.jpg\n",
      "\n",
      "(41, ':processed--->', '0--Parade/0_Parade_marchingband_1_112.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_112.jpg\n",
      "\n",
      "(42, ':processed--->', '0--Parade/0_Parade_Parade_0_188.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_188.jpg\n",
      "\n",
      "(43, ':processed--->', '0--Parade/0_Parade_Parade_0_883.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_883.jpg\n",
      "\n",
      "(44, ':processed--->', '0--Parade/0_Parade_marchingband_1_873.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_873.jpg\n",
      "\n",
      "(45, ':processed--->', '0--Parade/0_Parade_Parade_0_516.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_516.jpg\n",
      "\n",
      "(46, ':processed--->', '0--Parade/0_Parade_marchingband_1_242.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_242.jpg\n",
      "\n",
      "(47, ':processed--->', '0--Parade/0_Parade_marchingband_1_925.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_925.jpg\n",
      "\n",
      "(48, ':processed--->', '0--Parade/0_Parade_Parade_0_332.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_332.jpg\n",
      "\n",
      "(49, ':processed--->', '0--Parade/0_Parade_marchingband_1_377.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_377.jpg\n",
      "\n",
      "(50, ':processed--->', '0--Parade/0_Parade_Parade_0_132.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_132.jpg\n",
      "\n",
      "(51, ':processed--->', '0--Parade/0_Parade_Parade_0_233.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_233.jpg\n",
      "\n",
      "(52, ':processed--->', '0--Parade/0_Parade_Parade_0_439.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_439.jpg\n",
      "\n",
      "(53, ':processed--->', '0--Parade/0_Parade_Parade_0_507.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_507.jpg\n",
      "\n",
      "(54, ':processed--->', '0--Parade/0_Parade_marchingband_1_218.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_218.jpg\n",
      "\n",
      "(55, ':processed--->', '0--Parade/0_Parade_marchingband_1_126.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_126.jpg\n",
      "\n",
      "(56, ':processed--->', '0--Parade/0_Parade_marchingband_1_354.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_354.jpg\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(57, ':processed--->', '0--Parade/0_Parade_Parade_0_676.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_676.jpg\n",
      "\n",
      "(58, ':processed--->', '0--Parade/0_Parade_Parade_0_27.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_27.jpg\n",
      "\n",
      "(59, ':processed--->', '0--Parade/0_Parade_Parade_0_359.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_359.jpg\n",
      "\n",
      "(60, ':processed--->', '0--Parade/0_Parade_Parade_0_532.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_532.jpg\n",
      "\n",
      "(61, ':processed--->', '0--Parade/0_Parade_marchingband_1_1046.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_1046.jpg\n",
      "\n",
      "(62, ':processed--->', '0--Parade/0_Parade_Parade_0_92.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_92.jpg\n",
      "\n",
      "(63, ':processed--->', '0--Parade/0_Parade_marchingband_1_472.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_472.jpg\n",
      "\n",
      "(64, ':processed--->', '0--Parade/0_Parade_Parade_0_852.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_852.jpg\n",
      "\n",
      "(65, ':processed--->', '0--Parade/0_Parade_Parade_0_744.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_744.jpg\n",
      "\n",
      "(66, ':processed--->', '0--Parade/0_Parade_marchingband_1_883.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_883.jpg\n",
      "\n",
      "(67, ':processed--->', '0--Parade/0_Parade_marchingband_1_1018.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_1018.jpg\n",
      "\n",
      "(68, ':processed--->', '0--Parade/0_Parade_marchingband_1_1030.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_1030.jpg\n",
      "\n",
      "(69, ':processed--->', '0--Parade/0_Parade_marchingband_1_921.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_921.jpg\n",
      "\n",
      "(70, ':processed--->', '0--Parade/0_Parade_Parade_0_761.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_761.jpg\n",
      "\n",
      "(71, ':processed--->', '0--Parade/0_Parade_marchingband_1_808.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_808.jpg\n",
      "\n",
      "(72, ':processed--->', '0--Parade/0_Parade_marchingband_1_495.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_495.jpg\n",
      "\n",
      "(73, ':processed--->', '0--Parade/0_Parade_marchingband_1_286.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_286.jpg\n",
      "\n",
      "(74, ':processed--->', '0--Parade/0_Parade_Parade_0_142.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_142.jpg\n",
      "\n",
      "(75, ':processed--->', '0--Parade/0_Parade_Parade_0_35.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_35.jpg\n",
      "\n",
      "(76, ':processed--->', '0--Parade/0_Parade_Parade_0_37.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_37.jpg\n",
      "\n",
      "(77, ':processed--->', '0--Parade/0_Parade_Parade_0_942.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_942.jpg\n",
      "\n",
      "(78, ':processed--->', '0--Parade/0_Parade_Parade_0_553.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_553.jpg\n",
      "\n",
      "(79, ':processed--->', '0--Parade/0_Parade_marchingband_1_841.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_841.jpg\n",
      "\n",
      "(80, ':processed--->', '0--Parade/0_Parade_Parade_0_327.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_327.jpg\n",
      "\n",
      "(81, ':processed--->', '0--Parade/0_Parade_marchingband_1_140.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_140.jpg\n",
      "\n",
      "(82, ':processed--->', '0--Parade/0_Parade_Parade_0_547.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_547.jpg\n",
      "\n",
      "(83, ':processed--->', '0--Parade/0_Parade_Parade_0_644.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_644.jpg\n",
      "\n",
      "(84, ':processed--->', '0--Parade/0_Parade_marchingband_1_146.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_146.jpg\n",
      "\n",
      "(85, ':processed--->', '0--Parade/0_Parade_Parade_0_614.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_614.jpg\n",
      "\n",
      "(86, ':processed--->', '0--Parade/0_Parade_marchingband_1_535.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_535.jpg\n",
      "\n",
      "(87, ':processed--->', '0--Parade/0_Parade_Parade_0_441.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_441.jpg\n",
      "\n",
      "(88, ':processed--->', '0--Parade/0_Parade_Parade_0_780.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_780.jpg\n",
      "\n",
      "(89, ':processed--->', '0--Parade/0_Parade_marchingband_1_775.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_775.jpg\n",
      "\n",
      "(90, ':processed--->', '0--Parade/0_Parade_Parade_0_193.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_193.jpg\n",
      "\n",
      "(91, ':processed--->', '0--Parade/0_Parade_marchingband_1_341.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_341.jpg\n",
      "\n",
      "(92, ':processed--->', '0--Parade/0_Parade_marchingband_1_219.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_219.jpg\n",
      "\n",
      "(93, ':processed--->', '0--Parade/0_Parade_Parade_0_615.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_615.jpg\n",
      "\n",
      "(94, ':processed--->', '0--Parade/0_Parade_marchingband_1_632.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_632.jpg\n",
      "\n",
      "(95, ':processed--->', '0--Parade/0_Parade_Parade_0_126.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_126.jpg\n",
      "\n",
      "(96, ':processed--->', '0--Parade/0_Parade_marchingband_1_409.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_409.jpg\n",
      "\n",
      "(97, ':processed--->', '0--Parade/0_Parade_Parade_0_674.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_674.jpg\n",
      "\n",
      "(98, ':processed--->', '0--Parade/0_Parade_marchingband_1_656.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_656.jpg\n",
      "\n",
      "(99, ':processed--->', '0--Parade/0_Parade_Parade_0_326.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_326.jpg\n",
      "\n",
      "(100, ':processed--->', '0--Parade/0_Parade_Parade_0_253.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_253.jpg\n",
      "\n",
      "(101, ':processed--->', '0--Parade/0_Parade_marchingband_1_1038.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_1038.jpg\n",
      "\n",
      "(102, ':processed--->', '0--Parade/0_Parade_Parade_0_152.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_152.jpg\n",
      "\n",
      "(103, ':processed--->', '0--Parade/0_Parade_marchingband_1_641.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_641.jpg\n",
      "\n",
      "(104, ':processed--->', '0--Parade/0_Parade_Parade_0_209.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_209.jpg\n",
      "\n",
      "(105, ':processed--->', '0--Parade/0_Parade_Parade_0_336.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_336.jpg\n",
      "\n",
      "(106, ':processed--->', '0--Parade/0_Parade_marchingband_1_17.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_17.jpg\n",
      "\n",
      "(107, ':processed--->', '0--Parade/0_Parade_marchingband_1_19.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_19.jpg\n",
      "\n",
      "(108, ':processed--->', '0--Parade/0_Parade_marchingband_1_253.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_253.jpg\n",
      "\n",
      "(109, ':processed--->', '0--Parade/0_Parade_Parade_0_897.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_897.jpg\n",
      "\n",
      "(110, ':processed--->', '0--Parade/0_Parade_marchingband_1_691.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_691.jpg\n",
      "\n",
      "(111, ':processed--->', '0--Parade/0_Parade_marchingband_1_588.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_588.jpg\n",
      "\n",
      "(112, ':processed--->', '0--Parade/0_Parade_marchingband_1_673.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_673.jpg\n",
      "\n",
      "(113, ':processed--->', '0--Parade/0_Parade_Parade_0_605.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_605.jpg\n",
      "\n",
      "(114, ':processed--->', '0--Parade/0_Parade_Parade_0_731.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_731.jpg\n",
      "\n",
      "(115, ':processed--->', '0--Parade/0_Parade_Parade_0_595.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_595.jpg\n",
      "\n",
      "(116, ':processed--->', '0--Parade/0_Parade_Parade_0_145.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_145.jpg\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(117, ':processed--->', '0--Parade/0_Parade_Parade_0_868.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_868.jpg\n",
      "\n",
      "(118, ':processed--->', '0--Parade/0_Parade_marchingband_1_163.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_163.jpg\n",
      "\n",
      "(119, ':processed--->', '0--Parade/0_Parade_Parade_0_176.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_176.jpg\n",
      "\n",
      "(120, ':processed--->', '0--Parade/0_Parade_marchingband_1_388.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_388.jpg\n",
      "\n",
      "(121, ':processed--->', '0--Parade/0_Parade_Parade_0_803.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_803.jpg\n",
      "\n",
      "(122, ':processed--->', '0--Parade/0_Parade_Parade_0_4.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_4.jpg\n",
      "\n",
      "(123, ':processed--->', '0--Parade/0_Parade_marchingband_1_473.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_473.jpg\n",
      "\n",
      "(124, ':processed--->', '0--Parade/0_Parade_Parade_0_123.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_123.jpg\n",
      "\n",
      "(125, ':processed--->', '0--Parade/0_Parade_marchingband_1_594.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_594.jpg\n",
      "\n",
      "(126, ':processed--->', '0--Parade/0_Parade_marchingband_1_644.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_644.jpg\n",
      "\n",
      "(127, ':processed--->', '0--Parade/0_Parade_Parade_0_5.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_5.jpg\n",
      "\n",
      "(128, ':processed--->', '0--Parade/0_Parade_Parade_0_89.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_89.jpg\n",
      "\n",
      "(129, ':processed--->', '0--Parade/0_Parade_marchingband_1_381.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_381.jpg\n",
      "\n",
      "(130, ':processed--->', '0--Parade/0_Parade_marchingband_1_5.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_5.jpg\n",
      "\n",
      "(131, ':processed--->', '0--Parade/0_Parade_Parade_0_454.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_454.jpg\n",
      "\n",
      "(132, ':processed--->', '0--Parade/0_Parade_Parade_0_228.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_228.jpg\n",
      "\n",
      "(133, ':processed--->', '0--Parade/0_Parade_Parade_0_31.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_31.jpg\n",
      "\n",
      "(134, ':processed--->', '0--Parade/0_Parade_Parade_0_363.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_363.jpg\n",
      "\n",
      "(135, ':processed--->', '0--Parade/0_Parade_Parade_0_522.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_522.jpg\n",
      "\n",
      "(136, ':processed--->', '0--Parade/0_Parade_marchingband_1_422.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_422.jpg\n",
      "\n",
      "(137, ':processed--->', '0--Parade/0_Parade_Parade_0_702.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_702.jpg\n",
      "\n",
      "(138, ':processed--->', '0--Parade/0_Parade_marchingband_1_431.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_431.jpg\n",
      "\n",
      "(139, ':processed--->', '0--Parade/0_Parade_Parade_0_528.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_528.jpg\n",
      "\n",
      "(140, ':processed--->', '0--Parade/0_Parade_Parade_0_42.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_42.jpg\n",
      "\n",
      "(141, ':processed--->', '0--Parade/0_Parade_Parade_0_178.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_178.jpg\n",
      "\n",
      "(142, ':processed--->', '0--Parade/0_Parade_Parade_0_415.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_415.jpg\n",
      "\n",
      "(143, ':processed--->', '0--Parade/0_Parade_marchingband_1_774.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_774.jpg\n",
      "\n",
      "(144, ':processed--->', '0--Parade/0_Parade_Parade_0_97.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_97.jpg\n",
      "\n",
      "(145, ':processed--->', '0--Parade/0_Parade_marchingband_1_847.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_847.jpg\n",
      "\n",
      "(146, ':processed--->', '0--Parade/0_Parade_marchingband_1_95.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_95.jpg\n",
      "\n",
      "(147, ':processed--->', '0--Parade/0_Parade_Parade_0_924.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_924.jpg\n",
      "\n",
      "(148, ':processed--->', '0--Parade/0_Parade_marchingband_1_630.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_630.jpg\n",
      "\n",
      "(149, ':processed--->', '0--Parade/0_Parade_Parade_0_271.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_Parade_0_271.jpg\n",
      "\n",
      "(150, ':processed--->', '0--Parade/0_Parade_marchingband_1_464.jpg')\n",
      "imagePath:../widerface/WIDER_train/images/0--Parade/0_Parade_marchingband_1_464.jpg\n",
      "\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-1-0dcbbc27b701>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m    266\u001b[0m              \u001b[0mlabelTxtPath\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    267\u001b[0m              \u001b[0mimageFolder\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 268\u001b[0;31m              \u001b[0mmode\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    269\u001b[0m             )\n",
      "\u001b[0;32m<ipython-input-1-0dcbbc27b701>\u001b[0m in \u001b[0;36mmakeAll\u001b[0;34m(vocXmlWay, vocJpegWay, vocImageSetsMainWay, labelTxtPath, imageFolder, mode)\u001b[0m\n\u001b[1;32m    242\u001b[0m     \u001b[0;32mfor\u001b[0m \u001b[0mroidb\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mroidbs\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    243\u001b[0m         \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcnt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m':processed--->'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mroidb\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 244\u001b[0;31m         \u001b[0mwriteXml\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mroidb\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mimageFolder\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mvocXmlWay\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mvocJpegWay\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    245\u001b[0m         \u001b[0msetJpeg\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mroidb\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mimageFolder\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mvocJpegWay\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvocImageSetsMainWay\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mmode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    246\u001b[0m         \u001b[0mcnt\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m<ipython-input-1-0dcbbc27b701>\u001b[0m in \u001b[0;36mwriteXml\u001b[0;34m(roidb, imageFolder, vocXmlWay, vocJpegWay)\u001b[0m\n\u001b[1;32m     60\u001b[0m     \u001b[0mimagePath\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mimageFolder\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0mimageName\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     61\u001b[0m     \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'imagePath:%s\\n'\u001b[0m\u001b[0;34m%\u001b[0m\u001b[0mimagePath\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 62\u001b[0;31m     \u001b[0mimg\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcv2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mimagePath\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     63\u001b[0m     \u001b[0mh\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mimg\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     64\u001b[0m     \u001b[0mw\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mimg\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import cv2\n",
    "import shutil\n",
    "import os\n",
    "from xml.dom.minidom import Document    \n",
    "\n",
    "def widerFaceToRoidb(txtFileName):\n",
    "    fp = open(txtFileName,'r')\n",
    "    datas = fp.readlines()\n",
    "    faceData = []\n",
    "    print('datas number is: ', len(datas))\n",
    "    faceCount = 0\n",
    "    i = 0\n",
    "    boxCount = 0\n",
    "    while( i < len(datas)):\n",
    "        imagePath = datas[i].strip()\n",
    "        boxesNumber = int(datas[i+1].strip())\n",
    "        boxes = []\n",
    "        boxes.append(imagePath)\n",
    "        # print('face Count :%s,'%(faceCount))\n",
    "        # print('facefileName:%s'%imagePath)\n",
    "        #print('boxesNumber:%d'%boxesNumber)\n",
    "        i += 1\n",
    "        for k in range(boxesNumber):\n",
    "            i = i + 1\n",
    "            boxCount += 1\n",
    "            box = datas[i].strip().split(' ')\n",
    "            #print('%d: box:%s\\n'%(i,box))\n",
    "            boxes.append(box)\n",
    "        i += 1\n",
    "        faceCount += 1\n",
    "        faceData.append(boxes)\n",
    "    print('fileCount:%d,boxCount:%d'%(faceCount, boxCount))\n",
    "    return faceData\n",
    "        \n",
    "def checkWay(way):\n",
    "    if not os.path.exists(way):\n",
    "        os.makedirs(way)\n",
    "def setJpeg(roidb,imageFolder,vocJpegWay, vocImageSetsMainWay,mode):\n",
    "    imageName =  roidb[0]\n",
    "    imagePath = imageFolder+imageName\n",
    "     # copy -> vocJpegWay\n",
    "    imageName = imageName.split('/')[1]\n",
    "    \n",
    "    shutil.copy(imagePath,vocJpegWay+imageName)\n",
    "    outFile= open(vocImageSetsMainWay+mode+'.txt','a')\n",
    "    outFile.write(imageName.split('.')[0]+'\\n')\n",
    "    outFile.close()\n",
    "   \n",
    "    \n",
    "\n",
    "def writeXml(roidb, imageFolder,vocXmlWay,vocJpegWay):\n",
    "    erroFile = open('erroFile.txt','a')\n",
    "    imageName =  roidb[0]\n",
    "    labelData = np.array(roidb[1:],dtype=int).reshape(1,-1)\n",
    "    \n",
    "    bboxes = []\n",
    "    classId = []\n",
    "    otherDatas = []\n",
    "    imagePath = imageFolder+imageName\n",
    "    print('imagePath:%s\\n'%imagePath)\n",
    "    img = cv2.imread(imagePath)\n",
    "    h = img.shape[0]\n",
    "    w = img.shape[1]\n",
    "                                \n",
    "    imageName = imageName.split('/')[1]\n",
    "                                \n",
    "    for i in range(0,labelData.shape[1],10) :\n",
    "         box = labelData[0][i:i+4]\n",
    "         box[2] = box[0] + box[2]\n",
    "         box[3] = box[1] + box[3]                     \n",
    "         for j in range(4):\n",
    "            if box[j] < 1:\n",
    "                box[j] = 1\n",
    "         for j in range(0,4,2):\n",
    "            if box[j] > w:\n",
    "                box[j] = w\n",
    "         for j in range(1,4,2):\n",
    "            if box[j] > h:\n",
    "                box[j] = h\n",
    "         # assert box[2]>=box[0], 'box[2]>=box[0]'\n",
    "         # assert box[3]>=box[1], 'box[3]>=box[1]'\n",
    "#          assert box[0]>=1,'x1<0'\n",
    "#          assert box[1]>=1,'y1<0'\n",
    "#          assert box[2]>=1,'x2<0'\n",
    "#          assert box[3]>=1,'y2<0'\n",
    "#          assert box[0]<=w,'x1>w'\n",
    "#          assert box[1]<=h,'y1>h'\n",
    "#          assert box[2]<=w,'x2>w'\n",
    "#          assert box[3]<=h,'y2>h'\n",
    "         if box[2] < box[0] or box[3] <box[1]:\n",
    "             erroFile.write(imagePath+'\\n')\n",
    "             continue\n",
    "         bboxes.append(box)\n",
    "         className = 'face'\n",
    "         classId.append(className)\n",
    "         otherDatas.append(labelData[0][i+4:i+10])  \n",
    "          \n",
    "    \n",
    "    folder_txt=vocJpegWay.split('/')[-2]\n",
    "    doc=Document()\n",
    "    annotation=doc.createElement('annotation')\n",
    "    doc.appendChild(annotation)\n",
    "\n",
    "    #folder\n",
    "    folder = doc.createElement('folder')\n",
    "    folder_txt = doc.createTextNode(folder_txt)\n",
    "    folder.appendChild(folder_txt)\n",
    "    annotation.appendChild(folder)\n",
    "\n",
    "    #filename\n",
    "    filename = doc.createElement('filename')\n",
    "    filename_txt = doc.createTextNode(imageName.split('.')[0])\n",
    "    filename.appendChild(filename_txt)\n",
    "    annotation.appendChild(filename)\n",
    "\n",
    "    #path\n",
    "    path = doc.createElement('path')\n",
    "    path_txt = doc.createTextNode(vocJpegWay+imageName)\n",
    "    path.appendChild(path_txt)\n",
    "    annotation.appendChild(path)\n",
    "\n",
    "    #size\n",
    "    size = doc.createElement('size')\n",
    "    annotation.appendChild(size)\n",
    "\n",
    "    #width\n",
    "    width = doc.createElement('width')\n",
    "    width_txt = doc.createTextNode(str(w))\n",
    "    width.appendChild(width_txt)\n",
    "    size.appendChild(width)\n",
    "\n",
    "    #height\n",
    "    height = doc.createElement('height')\n",
    "    height_txt = doc.createTextNode(str(h))\n",
    "    height.appendChild(height_txt)\n",
    "    size.appendChild(height)\n",
    "\n",
    "    #depth\n",
    "    depth = doc.createElement('depth')\n",
    "    depth_txt = doc.createTextNode('3')\n",
    "    depth.appendChild(depth_txt)\n",
    "    size.appendChild(depth)\n",
    "\n",
    "    #segmented\n",
    "    segmented = doc.createElement('segmented')\n",
    "    segmented_txt = doc.createTextNode('0')\n",
    "    segmented.appendChild(segmented_txt)\n",
    "    annotation.appendChild(folder)\n",
    "    object1=[]\n",
    "    for i in range(len(bboxes)):\n",
    "        object1.append('name'+str(i))\n",
    "        object1[i]= doc.createElement('object')\n",
    "        annotation.appendChild(object1[i])\n",
    "\n",
    "        #name\n",
    "        name = doc.createElement('name')\n",
    "        name_txt = doc.createTextNode(classId[i])\n",
    "        name.appendChild(name_txt)\n",
    "        object1[i].appendChild(name)\n",
    "        #truncated\n",
    "        truncated = doc.createElement('truncated')\n",
    "        truncated_txt = doc.createTextNode('0')\n",
    "        truncated.appendChild(truncated_txt)\n",
    "        object1[i].appendChild(truncated)\n",
    "        #difficult\n",
    "        difficult = doc.createElement('difficult')\n",
    "        difficult_txt = doc.createTextNode('0')\n",
    "        difficult.appendChild(difficult_txt)\n",
    "        object1[i].appendChild(difficult)\n",
    "        # blur\n",
    "        blur = doc.createElement('blur')\n",
    "        blur_txt = doc.createTextNode(str(otherDatas[i][0]))\n",
    "        blur.appendChild(blur_txt)\n",
    "        object1[i].appendChild(blur)\n",
    "        # expression\n",
    "        expression = doc.createElement('expression')\n",
    "        expression_txt = doc.createTextNode(str(otherDatas[i][1]))\n",
    "        expression.appendChild(expression_txt)\n",
    "        object1[i].appendChild(expression)\n",
    "        # illumination\n",
    "        illumination = doc.createElement('illumination')\n",
    "        illumination_txt = doc.createTextNode(str(otherDatas[i][2]))\n",
    "        illumination.appendChild(illumination_txt)\n",
    "        object1[i].appendChild(illumination)\n",
    "        # invalid\n",
    "        invalid = doc.createElement('invalid')\n",
    "        invalid_txt = doc.createTextNode(str(otherDatas[i][3]))\n",
    "        invalid.appendChild(invalid_txt)\n",
    "        object1[i].appendChild(invalid)\n",
    "        # occlusion\n",
    "        occlusion = doc.createElement('occlusion')\n",
    "        occlusion_txt = doc.createTextNode(str(otherDatas[i][4]))\n",
    "        occlusion.appendChild(occlusion_txt)\n",
    "        object1[i].appendChild(occlusion)\n",
    "        #pose\n",
    "        pose = doc.createElement('pose')\n",
    "        pose_txt = doc.createTextNode(str(otherDatas[i][5]))\n",
    "        pose.appendChild(pose_txt)\n",
    "        object1[i].appendChild(pose)\n",
    "        \n",
    "        #bndbox\n",
    "        bndbox = doc.createElement('bndbox')\n",
    "        object1[i].appendChild(bndbox)\n",
    "\n",
    "        #xmin\n",
    "        xmin = doc.createElement('xmin')\n",
    "        xmin_txt = doc.createTextNode(str(int(bboxes[i][0])))\n",
    "        xmin.appendChild(xmin_txt)\n",
    "        bndbox.appendChild(xmin)\n",
    "\n",
    "        #ymin\n",
    "        ymin = doc.createElement('ymin')\n",
    "        ymin_txt = doc.createTextNode(str(int(bboxes[i][1])))\n",
    "        ymin.appendChild(ymin_txt)\n",
    "        bndbox.appendChild(ymin)\n",
    "\n",
    "        #xmax\n",
    "        xmax = doc.createElement('xmax')\n",
    "        xmax_txt = doc.createTextNode(str(int(bboxes[i][2])))\n",
    "        xmax.appendChild(xmax_txt)\n",
    "        bndbox.appendChild(xmax)\n",
    "\n",
    "        #ymax\n",
    "        ymax = doc.createElement('ymax')\n",
    "        ymax_txt = doc.createTextNode(str(int(bboxes[i][3])))\n",
    "        ymax.appendChild(ymax_txt)\n",
    "        bndbox.appendChild(ymax)\n",
    "    xmlName=vocXmlWay+imageName.split('.')[0]+'.xml'\n",
    "    f=open(xmlName,'w')\n",
    "    doc.writexml(f,indent = '\\t',newl = '\\n', addindent = '\\t',encoding='utf-8')\n",
    "    f.close()\n",
    "def makeAll( vocXmlWay,\n",
    "             vocJpegWay,\n",
    "             vocImageSetsMainWay,\n",
    "             labelTxtPath,\n",
    "             imageFolder,\n",
    "             mode\n",
    "            ):\n",
    "    roidbs = widerFaceToRoidb(labelTxtPath)\n",
    "    cnt = 1\n",
    "    for roidb in roidbs:\n",
    "        print(cnt,':processed--->',roidb[0])\n",
    "        writeXml(roidb, imageFolder,vocXmlWay,vocJpegWay)\n",
    "        setJpeg(roidb,imageFolder,vocJpegWay, vocImageSetsMainWay,mode)\n",
    "        cnt += 1\n",
    "\n",
    "if  __name__ == '__main__':\n",
    "    print('hello widerface')\n",
    "    vocWay='../VOCdevkit/VOC2007-test' # VOC FILE folder\n",
    "    vocXmlWay=vocWay+'/Annotations/' # Annotations File folder\n",
    "    vocJpegWay=vocWay+'/JPEGImages/' # image File\n",
    "    vocImageSetsMainWay = vocWay+'/ImageSets/Main/' # txt file\n",
    "         \n",
    "    mode = 'train'  # data's mode (train/val)            \n",
    "    labelTxtPath = '../widerface/wider_face_split/wider_face_%s_bbx_gt.txt'%(mode) # widerface Annotations file  \n",
    "    imageFolder = '../widerface/WIDER_%s/images/'%(mode)                           # widerface image File \n",
    "\n",
    "    checkWay(vocWay)\n",
    "    checkWay(vocJpegWay)\n",
    "    checkWay(vocImageSetsMainWay)\n",
    "    checkWay(vocXmlWay)\n",
    "    makeAll( vocXmlWay,\n",
    "             vocJpegWay,\n",
    "             vocImageSetsMainWay,\n",
    "             labelTxtPath,\n",
    "             imageFolder,\n",
    "             mode\n",
    "            )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
